﻿using System.Data.Entity;
using System.Reflection;
using Abp.Modules;
using Abp.Zero.EntityFramework;
using FutureApp.EntityFramework;
using FutureApp.Configuration;

namespace FutureApp
{
    [DependsOn(typeof(AbpZeroEntityFrameworkModule), typeof(FutureAppCoreModule))]
    public class FutureAppDataModule : AbpModule
    {
        public override void PreInitialize()
        {
            Database.SetInitializer(new CreateDatabaseIfNotExists<FutureAppDbContext>());
            Configuration.DefaultNameOrConnectionString = SettingsManager.GetAppSetting("website:ConnectionStringName");
        }

        public override void Initialize()
        {
            IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());
        }
    }
}
